<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="common/include :: header('新增部门')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-dept-add">

        <div class="col-sm-12">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所属客户：</label>
                    <div class="col-sm-8">

                            <select name="customerId" class="form-control">
                                <option value="">请选择</option>
                                <option th:each="customer : ${customerList}" th:text="${customer.customerName}"
                                        th:value="${customer.id}"></option>
                            </select>

                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">联系人名字：</label>
                    <div class="col-sm-8">
                            <input class="form-control" id="linkman" type="text" name="linkman">
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-12">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">电话：</label>
                    <div class="col-sm-8">
                        <input class="form-control" id="phone" type="text" name="phone"  required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">性别：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_user_sex')}">
                            <input type="radio" th:id="${dict.id}" name="gender" th:value="${dict.value}" th:checked="${dict.isDefault}">
                            <label th:for="${dict.id}" th:text="${dict.label}"></label>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-12">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">年龄：</label>
                    <div class="col-sm-8">
                        <input class="form-control" id="age"  type="text" name="age">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">部门：</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" id="department" name="department">
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-12">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">职位：</label>
                    <div class="col-sm-8">
                        <input class="form-control" id="position" type="text" name="position">
                    </div>
                </div>
            </div>

        </div>


    </form>
</div>
<th:block th:include="common/include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "/business/customerLinkMane";
    //表单验证
    $("#form-dept-add").validate({
        onkeyup: false,
        rules:{
            linkman:'required',  //必填
            age:{
                required:true,
                minlength: 1,
                maxlength: 2
            },
            phone:{
                isPhone:true
            },
            department:'required',
            position:'required'
        },
        messages: {
            linkman:'请输入联系人',
            department:'部门不能为空',
            age:{
                required:'年龄不能为空'
            },
            phone:{
                required:'电话号码不能为空'
            },
            position:'职位不能为空'
        },
        focusCleanup: true
    });
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
        }
    }

</script>
</body>
</html>
